#include "WindowStateSave.h"

WindowStateSave::WindowStateSave(QMainWindow* qInstaance)
{
	m_MainWindowInstance = qInstaance;
}

bool WindowStateSave::RestoreSettings()
{
	QSettings settings(COMPANY, APP);
	return m_MainWindowInstance->restoreGeometry(settings.value(GEOMETRY).toByteArray()) &&
	m_MainWindowInstance->restoreState(settings.value(WINDOWSTATE).toByteArray());
}


void WindowStateSave::SaveSettings()
{
	QSettings settings(COMPANY, APP);
	settings.setValue(GEOMETRY, m_MainWindowInstance->saveGeometry());
	settings.setValue(WINDOWSTATE, m_MainWindowInstance->saveState());
}


bool WindowStateSave::RestoreDockWidgets(QList<QDockWidget*> qDockWidgetList)
{
	for (size_t i = 0; i < qDockWidgetList.size(); i++)
	{
		if (!m_MainWindowInstance->restoreDockWidget(qDockWidgetList[i])) return false;
	}
	return true;
}